package 饮料换购143;

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner=new Scanner(System.in);
		int n=scanner.nextInt();
		int num=n;
		int sum=n;
		while(sum>=3) {
			int tmp=sum/3;
			num+=tmp;
			sum=sum%3+tmp;
		}
		System.out.println(num);
	}
}
